<template>
  <div>
    <ul>
      <li v-for="item in GoodList" :key="item.id" @click="getGoods(item)">
        <img :src="item.list_pic_url" alt="" width="100%" />
        <div class="title">{{ item.name }}</div>
        <div class="price">{{ item.retail_price | filtermoney}}</div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: ["GoodList"],
  name: "Product",
  data() {
    return {
      godList: [],
    };
  },  
  methods: {
    getGoods(item) {
      this.$router.push(
       "/productdetail/" + item.id,
      );
    },
  },
};
</script>

<style lang="less" scoped>
ul {
  background-color: #efefef;
  padding: 0.1rem 2%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  li {
    width: 49%;
    background-color: #fff;
    text-align: center;
    line-height: 0.3rem;
    margin-bottom: 0.1rem;
    .title {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      height: 50px;
    }
    .price {
      color: darkred;
    }
  }
  li:nth-last-child(1){
    margin-bottom: 0.5rem;
  }
}
</style>